package com.ebao.util;

import java.util.ArrayList;
import java.util.List;
import java.util.Random;

/**
 * @description 生成随机六位密码
 * @author alfred
 * @date 2012-05-30
 */
public class GeneratePassword {

	@SuppressWarnings({ "rawtypes", "unchecked" })
	public static String getPassword() {

		char character[] = { 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j',
				'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v',
				'w', 'x', 'y', 'z', '0', '1', '2', '3', '4', '5', '6', '7',
				'8', '9' };

		Random rand = new Random();

		List passwordList = new ArrayList();

		String password = "";

		for (int i = 0; i < 6; i++) {
			passwordList.add(character[rand.nextInt(36)]);
		}

		for (int i = 0; i < passwordList.size(); i++) {
			password += passwordList.get(i);
		}
		
		return password;
	}

}
